<template>
  <div class="rank">
    <van-icon class="close" @click="closeRank" size="30px" name="close" />
    <van-tabs v-model="active" ref="tabs">
      <van-tab title="活动规则">
        <div class="container">
          <div class="item">
            <div class="title">活动奖品</div>
            <div class="main">
              <p>一等奖</p>
              <p>一等奖</p>
              <p>一等奖</p>
            </div>
          </div>
          <div class="item">
            <div class="title">活动时间</div>
            <div class="main">17点53分</div>
          </div>
          <div class="item">
            <div class="title">活动说明</div>
            <div class="main">把行走的粽子拖到下方，不要被筷子夹走哦！</div>
          </div>
          <!-- <div class="item">

              </div> -->
        </div>
      </van-tab>
      <van-tab title="排行榜">
        <div class="container rk">
          <p>-- 只显示前100名 --</p>
          <div class="main">
            <div class="item" v-for="(item, index) in rankList" :key="index">
              <div class="no">NO.{{ index + 1 }}</div>
              <img :src="item.pic" alt="" />
              <div class="nickname">{{ item.nickname }}</div>
              <div class="score">{{ item.score }}分</div>
            </div>
          </div>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
export default {
  props: ["act"],
  data() {
    return {
      active:this.act,
      rankList: [
        {
          nickname: "张三",
          score: 100,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "李四",
          score: 90,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "王五",
          score: 80,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "小红",
          score: 70,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "小明",
          score: 60,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "张伟",
          score: 50,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "凯",
          score: 40,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "上官婉儿",
          score: 30,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "后羿",
          score: 20,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
        {
          nickname: "吕布",
          score: 10,
          pic:
            "http://thirdwx.qlogo.cn/mmopen/vi_32/ic6z5GcnElw4fvpicGIiaJNtzKHzEu2gpLLibXmbKTnWY61ic8piarPIeKvyM8oxIPC2tHN6JmnNibEzOicdIkn39sL3Qg/132",
        },
      ],
    };
  },
  mounted() {
    this.$refs.tabs.resize();
  },
  methods: {
    closeRank() {
      this.$emit("closeRank");
    },
  },
};
</script>

<style lang="less" scoped>
.rank {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f7f8fa;
  color: #666;
  font-size: 0.746rem;
  z-index: 700;
  .close {
    position: fixed;
    right: 0.373rem;
    top: 0.373rem;
    z-index: 999;
  }
  .rk {
    p {
      text-align: center;
    }
    .main {
      .item {
        display: flex;
        align-items: center;
        img {
          width: 1.6rem;
          border-radius: 50%;
          margin-right: 0.533rem;
        }
        .score {
          font-weight: 700;
          color: #f33061;
        }
        .nickname {
          flex: 1;
        }
        .no {
          width: 20%;
        }
      }
    }
  }
}
.container {
  height: 100vh;
  padding: 10px;
  overflow: auto;
  .item {
    padding: 0.533rem 0;
    border-bottom: 1px dashed #ccc;
    &:last-child {
      border: none;
    }
  }
  .title {
    display: inline-block;
    color: #333;
    padding: 0.106rem 0.16rem;
    background-color: rgba(243, 48, 97, 0.08);
    margin-bottom: 0.266rem;
  }
}
</style>